import { ProColumns } from '@ant-design/pro-table'

export const columns: ProColumns<IT.IConfig>[] = [
    { title: '#', dataIndex: 'index', valueType: 'index', width: 30 },
    { title: '健值', dataIndex: 'key', width: 150, editable: false },
    { title: '配置值', dataIndex: 'value', width: 150, hideInSearch: true },
    { title: '备注', dataIndex: 'note', width: 100, ellipsis: true },
    {
        title: '所属企业',
        dataIndex: 'company',
        renderText: (_, r) => r.company?.companyName,
        width: 150,
        ellipsis: true,
        hideInSearch: true,
        editable: false,
    },
    {
        title: '创建人',
        dataIndex: 'au',
        hideInSearch: true,
        width: 60,
        ellipsis: true,
        editable: false,
    },
    {
        title: '创建时间',
        dataIndex: 'ct',
        hideInSearch: true,
        width: 60,
        ellipsis: true,
        editable: false,
    },
    {
        title: '更新人',
        dataIndex: 'ed',
        hideInSearch: true,
        width: 60,
        ellipsis: true,
        editable: false,
    },
    {
        title: '更新时间',
        dataIndex: 'ut',
        hideInSearch: true,
        width: 60,
        ellipsis: true,
        editable: false,
    },
    {
        title: '操作',
        key: 'option',
        width: 120,
        valueType: 'option',
        render: (_, row, index, action) => [
            <a
                key='a'
                onClick={() => {
                    action.startEditable(row.id as number)
                }}>
                编辑
            </a>,
        ],
    },
]
